package com.hydra.base.resp;

import com.hydra.base.utils.FormatUtil;
import lombok.Data;
import lombok.ToString;

import java.util.Date;

@Data
@ToString
public class ResultError {

	private String timestamp;

	private int status;

	private String error;

	private String path;

	private String message;

	public ResultError(){
	}

	public ResultError(int status){
		this.status = status;
	}

	public ResultError(int status, String error, String message, String path){
		this.status = status;
		this.error = error;
		this.message = message;
		this.path = path;

		this.timestamp = FormatUtil.formatDateTime(new Date());
	}

	public static ResultError failure(int status, String message){
		return ResultError.failure(status, null, message, null);
	}

	public static ResultError failure(int status, String error, String message, String path){
		return new ResultError(status, error, message, path);
	}

}
